package com.lesson14.observe;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/9/17 20:29
 */
public class CurrentConditions implements Observer
{
    //温度，气压，湿度
    private float temperature;
    private float pressure;
    private float humidity;

    //更新天气情况，是由WeatherData来调用，我使用推送模式
    public void update(float temperature, float pressure, float humidity)
    {
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        display();
    }

    public void display(){
        System.out.println("今日温度："+temperature+"***");
        System.out.println("今日气压："+pressure+"***");
        System.out.println("今日湿度："+humidity+"***");
    }
}
